<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVAllowanceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('v_allowance', function (Blueprint $table) {
            $table->increments('id');
            $table->bigInteger('shipping_id')->default(0)->comment('货运ID');
            $table->string('card_number',32)->default('')->comment('油卡卡号');
            $table->integer('allowance_fee')->default(0)->comment('补贴费用');
            $table->dateTime('return_time')->comment('油卡退还时间');
            $table->tinyInteger('status')->default(10)->comment('油卡退还时间，10车主使用中 20已退还 30车主丢失');
            $table->timestamps();
            $table->index('shipping_id', 'idx_shipping_id');
            $table->index('card_number', 'idx_card_number');
            $table->index('status', 'idx_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('v_allowance');
    }
}
